<?php

/**
 * This is the model class for table "wxuser".
 *
 * The followings are the available columns in table 'wxuser':
 * @property string $id_wxuser
 * @property string $avatar_url
 * @property string $nickname
 * @property string $nickname_encode
 * @property string $email
 * @property string $telephone
 * @property string $birthday
 * @property string $gender
 * @property string $province
 * @property string $city
 * @property string $district
 * @property string $openid
 * @property string $bonus
 * @property string $id_wxplatform
 * @property string $createtime
 * @property string $is_first_trade
 */
class Wxuser extends ActiveRecord
{
    const UN_FIRST_TRADE = 0;

    const FIRST_GETREDPACK = '1';
    const UNFIRST_GETREDPACK = '0';
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return Wxuser the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'wxuser';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		return array(
			array('id_wxuser, avatar_url, nickname, nickname_encode, openid, bonus, id_wxplatform, email, telephone, gender, birthday, province, city, district, createtime', 'safe'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		return array(
			
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
		);
	}

	public function getWxplatform()
	{
		return Wxplatform::model()->findByAttributes(array(
			'id_wxplatform' => $this->id_wxplatform
		));
	}
	
	
}